/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var nowyear = now.format('Y');
var loadServlet = '../../../servlet/data/YsjLoad';
 store = new Ext.data.JsonStore({
        url: loadServlet,
        root: 'data',
        idProperty: 'id',
        totalProperty: 'count',
        fields: fieldName,
        autoLoad:true,
        baseParams:{lock:lock,cmd:loadCmd,start:0,limit:_pageSize,yearTo:nowyear,reportStatus:reportStatus}
    });   
var centergrid=new Ext.grid.GridPanel({
    title:currentOrgName+ ' 合格率年度统计报表',
    store: store,
    
    colModel:centercolumnModel,
    enableColumnMove: false,
    viewConfig: {
        forceFit: false
    },
    
    loadMask: true,
    tbar: new Ext.Toolbar([
    reportCombo,
    rangeCombo,
    pointTypeCombo,   
    pointType2Combo,  
    pointText,    
    '-',
    yearToCombo,
    lblYear ,
     '-',
    searchButton,
    '-',
    {
        xtype: 'button',
        text: '导出',
        iconCls: 'icon-excel',
        width: 60,
        style: {
            marginLeft: '20px'
        },
        handler: downloadExcel
    }
    ]),
    bbar: new Ext.PagingToolbar({
        pageSize: _pageSize,
        store: store,
        displayInfo: true,
        displayMsg: '显示记录：{0} - {1}   总记录：{2}',
        emptyMsg:  '目前没有信息'
    })
});
store.load({
    params: {
        start: 0, 
        limit: _pageSize
    }
});

function downloadExcel(){
    store.baseParams.type=6;    
    var encodeParams = Ext.urlEncode(store.baseParams);
    open('../../../servlet/common/ExcelFileCreate?'+encodeParams);
}

function buildWindow(){
    var applicationUI = new Ext.Viewport({
        layout:'fit',
        items: [
        centergrid
        ]
    });
    if(reportStatus ===1){
        //Ext.getCmp('ReportStatus').setVisible(false);
        Ext.getCmp('ReportStatus').setValue(1);
    }
}
Ext.onReady(buildWindow); 


